package com.hongzhimei.yukicomic.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.hongzhimei.yukicomic.R;
import com.hongzhimei.yukicomic.utils.Apputils;
import com.hongzhimei.yukicomic.utils.getYukicom;
import com.hongzhimei.yukicomic.utils.ToastUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by yefengdong on 2016/12/22.
 */

public class LoginActivity extends BaseActivity implements View.OnClickListener {
    @Bind(R.id.et_phone)
    EditText etPhone;
    @Bind(R.id.et_pwd)
    EditText etPwd;
    @Bind(R.id.bt_login)
    Button btLogin;
    @Bind(R.id.tv_register)
    TextView tvRegister;
    @Bind(R.id.tv_forget_pwd)
    TextView tvForgetPwd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        ButterKnife.bind(this);
        initListener();
    }

    private void initListener() {
        btLogin.setOnClickListener(this);
        tvRegister.setOnClickListener(this);
        tvForgetPwd.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.bt_login://登录按钮点击响应事件
                login();
                break;
            case R.id.tv_register://注册按钮点击响应事件
                break;
            case R.id.tv_forget_pwd://忘记密码点击响应事件
                break;
        }
    }

    /**
     * 用户登录的逻辑处理
     */
    private void login(){
        String phone = etPhone.getText().toString().trim();
        String password = etPwd.getText().toString().trim();
        if(TextUtils.isEmpty(phone)||TextUtils.isEmpty(password)){
            ToastUtils.show(LoginActivity.this,getResources().getString(R.string.phone_pwd_empty));
            return;
        }else if(!Apputils.isMobile(phone)){
            ToastUtils.show(LoginActivity.this,getResources().getString(R.string.error_phone));
            return;
        }else{

        }
    }
}















































































